{% if errors %}
<div class="alert alert-danger" role="alert">
  <ul class="mb-0 ps-3">
    {% for e in errors %}
      <li>{{ e }}</li>
    {% endfor %}
  </ul>
</div>
{% endif %}

<div class="mb-3">
  <label for="name" class="form-label">仓库名称 *</label>
  <input type="text" class="form-control" id="name" name="name" value="{{ name|default:'' }}" required>
</div>

<div class="mb-3">
  <label for="location" class="form-label">位置 *</label>
  <select class="form-select" id="location" name="location" required>
    <option value="">请选择位置</option>
    {% for loc in locations %}
      <option value="{{ loc.id }}" {% if location_id|add:"" == loc.id|stringformat:"s" %}selected{% endif %}>{{ loc.name }}</option>
    {% endfor %}
  </select>
</div>

<div class="mb-3">
  <label for="manager" class="form-label">管理员</label>
  <select class="form-select" id="manager" name="manager">
    <option value="">请选择管理员</option>
    {% for u in users %}
      <option value="{{ u.id }}" {% if manager_id|add:"" == u.id|stringformat:"s" %}selected{% endif %}>{{ u.username }}</option>
    {% endfor %}
  </select>
</div>

<div class="mb-3">
  <label for="description" class="form-label">描述</label>
  <textarea class="form-control" id="description" name="description" rows="3">{{ description|default:'' }}</textarea>
</div>
